package com.hancai.manager;

import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * @author 涵菜
 * @version 1.0
 * manager层可用对service层通用能力的下沉，如缓存方案，中间件通用处理
 */
@Component
public class RedisManager {
    @Resource
    private RedisTemplate<String,Object>redisTemplate;

    public Object getValue(String key){
        return redisTemplate.opsForList().range(key,0,-1);
    }

    public <T> Object setValue(String key, Collection<T> data){
        return redisTemplate.opsForList().leftPushAll(key,data);
    }

}
